package com.tensquare.search.service;

import com.tensquare.search.dao.SearchDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.stereotype.Service;
import util.IdWorker;

@Service
public class SearchService {
    @Autowired
    private SearchDao searchDao;
    @Autowired
    private IdWorker idWorker;

    public Page findByTitleLike(String keywords, int page, int size) {
        PageRequest pageRequest= PageRequest.of(page-1,size);
        return
                searchDao.findByTitleOrContentLike(keywords,keywords,pageRequest);
    }
}
